import os
import cv2

image_dir = "./val2014"

image_filenames = os.listdir(image_dir)

with open('coco_2014.info', 'w') as f:
    for index, image_filename in enumerate(image_filenames):
        image_cv = cv2.imread(os.path.join(image_dir, image_filename))
        image_filename = 'val2014/' + image_filename
        line = "{} {} {} {}".format(index, image_filename, image_cv.shape[1], image_cv.shape[0])
        f.write(line)
        f.write('\n')
